﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;

using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;


public partial class Theme_3_UserControls_BBSCount : System.Web.UI.UserControl
{
    protected PowerCreator.LMS.Web.Config.WebConfig config = new PowerCreator.LMS.Web.Config.WebConfig();
    private int theDayNumOfWeek = 1;
    protected void Page_Load(object sender, EventArgs e)
    {
        BinderBBSCount();
    }
    private void BinderBBSCount()
    {
        //BBS统计
        PowerCreator.LMS.Web.BBS.ManagerBBS opBBS = new PowerCreator.LMS.Web.BBS.ManagerBBS();
        string search = string.Format("convert(varchar(12),ThemeCreatetime,112) = '{0}'", DateTime.Now.ToString("yyyyMMdd"));
        lbl_BBSToDayCount.Text = opBBS.CountTheme(search).ToString();
        search = string.Format("convert(varchar(12),ResversionCreateTime,112) = '{0}'", DateTime.Now.ToString("yyyyMMdd"));
        lbl_BBSToDayReversionCount.Text = opBBS.CountReversion(search).ToString();
        search = string.Format("convert(varchar(12),ThemeCreatetime,112) > '{0}' and convert(varchar(12),ThemeCreatetime,112) < '{1}'", DateTime.Now.AddDays(0 - theDayNumOfWeek).ToString("yyyyMMdd"), DateTime.Now.AddDays(8 - theDayNumOfWeek).ToString("yyyyMMdd"));
        lbl_BBSToDayWeekCount.Text = opBBS.CountTheme(search).ToString();
        search = string.Format("convert(varchar(12),ResversionCreateTime,112) > '{0}' and convert(varchar(12),ResversionCreateTime,112) < '{1}'", DateTime.Now.AddDays(0 - theDayNumOfWeek).ToString("yyyyMMdd"), DateTime.Now.AddDays(8 - theDayNumOfWeek).ToString("yyyyMMdd"));
        lbl_BBSToDayWeekReversion.Text = opBBS.CountReversion(search).ToString();

        search = "";
        lbl_BBSToDayHistoryCount.Text = opBBS.CountTheme(search).ToString();
        //lbl_BBSToDayWeekHistoryReversion.Text = opBBS.CountReversion(search).ToString();
    }

    private int getWeekNum()
    {
        int weeknum = 1;
        string dayofweek = DateTime.Now.DayOfWeek.ToString();
        switch (dayofweek)
        {
            case "Monday":
                weeknum = 1;
                break;
            case "星期一":
                weeknum = 1;
                break;
            case "Tuesday":
                weeknum = 2;
                break;
            case "星期二":
                weeknum = 2;
                break;
            case "Wednesday":
                weeknum = 3;
                break;
            case "星期三":
                weeknum = 3;
                break;
            case "Thursday":
                weeknum = 4;
                break;
            case "星期四":
                weeknum = 4;
                break;
            case "Friday":
                weeknum = 5;
                break;
            case "星期五":
                weeknum = 5;
                break;
            case "Saturday":
                weeknum = 6;
                break;
            case "星期六":
                weeknum = 6;
                break;
            case "Sunday":
                weeknum = 7;
                break;
            case "星期日":
                weeknum = 7;
                break;
            default:
                weeknum = 1;
                break;

        }
        return weeknum;
    }
}
